﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Utils.MathUtilitys;

namespace Utils.Layouting
{
    public class AlignedPlane : BasePlane
    {
        Vector2 align;

        public Vector2 Align { get { return align; } set { align = value; } }

        public AlignedPlane(Vector2 align, Vector2 maxSize)
        {
            this.align = align;
            this.maxSize = maxSize;
        }

        public override void UpdateSize(FRect newRect)
        {
            base.UpdateSize(newRect);

            rect.X = newRect.X + (align.X - 0.5f) * (newRect.Width - rect.Width);
            rect.Y = newRect.Y + (align.Y - 0.5f) * (newRect.Height - rect.Height);
        }
    }
}
